package demo_0407;

public class Main {
    public static void main(String[] args) throws InterruptedException {
        Thread.sleep(100);
    }


    public static String max(String c1, String c2) {
        return c1.compareTo(c2) > 0 ? c1 : c2;
    }

    public static <T extends Comparable<T>> T max(T c1, T c2) {
        System.out.println("泛型方法");
        return c1.compareTo(c2) > 0? c1 : c2;
    }


    public static void main3(String[] args) {
        System.out.println(max("hello", "world"));
    }



    public static void main2(String[] args) {
        GBox<Integer> box = new GBox<>(); //钻石操作符

        box.put(10);
        Integer b = box.take();
        System.out.println("in box :" + b);

        GBox<String> box1 = new GBox<>();
        box1.put("hello");
        String c = box1.take();
        System.out.println("in box1 :" + c);

    }


    public static void main1(String[] args) {

        Box box = new Box();
        int a = 10;
        box.put(a);

        Integer b = (Integer) box.take();
        System.out.println("in box :" + b);
        System.out.println();
    }
}
